Learn R Programming

pchc (version 1.2)

Plot of a Bayesian network: Plot of a Bayesian network

Description

Plot of a Bayesian network.

Usage

bnplot(dag, shape = "ellipse", main = NULL, sub = NULL, highlight = NULL)

Value

The Bayesian network is visualised.

Arguments

dag

A BN object, an object of class "bn".

shape

A character string defining the shape of the nodes, "ellipse" (default value), "circle" or "rectangle".

main

The main title of the graph displayed on the top.

sub

The subtitle of the graph displayed at the bottom.

highlight

A list with options specifying which nodes to plot with different colours. You can also check the package bnlearn or the package Rgraphviz for more information on this, or simply check the example below.

Author

Michail Tsagris.

R implementation and documentation: Michail Tsagris mtsagris@uoc.gr.

Details

The function is called from the "bnlearn" package which invokes the "Rgraphviz" package from Bioconductor and you need to install it first.

See Also

pchc, pc.skel

Examples

Run this code
# \donttest{
if (require("Rgraphviz") ) {
# simulate a dataset with continuous data
x <- matrix( rnorm(100 * 15, 1, 5), nrow = 100 )
colnames(x) <- paste("X", 1:15, sep = "")
nam <- colnames(x)
a <- pchc(x)
bnplot(a$dag)
bnplot( a$dag, highlight = list(nodes = nam[c(2, 3)],
col = "tomato", fill = "orange") )
}
# }

Run the code above in your browser using DataLab